package com.capgemini.scaffold.common;

import com.capgemini.scaffold.model.User;

import javax.servlet.http.HttpServletRequest;

import static com.capgemini.scaffold.constant.UserConstant.ADMIN_ROLE;
import static com.capgemini.scaffold.constant.UserConstant.USER_LOGIN_STATE;

/**
 * 鉴权
 */
public class Admin {

    /**
     * 是否为管理员
     * @param isRole
     * @return
     */
    public static boolean isAdmin(Integer isRole){
        //仅管理员可查询
        if(isRole == ADMIN_ROLE){
            return true;
        }
        return false;
//        Object userObj = request.getSession().getAttribute(USER_LOGIN_STATE);
//        User user = (User) userObj;
//        return user != null && user.getIsRole() == ADMIN_ROLE;
    }
}
